﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SPMS.Commons.Configuration.Xml
{
    /// <summary>
    /// 配置属性
    /// </summary>
    /// <remarks>定义了配置属性类</remarks>
    /// <history>
    /// [zanezeng]   2008-12-15 11:58    Created
    /// </history>
    public sealed class XmlConfigurationAttribute : IConfigurationAttribute
    {
        #region ---Constructor

        /// <summary>
        /// 初始化类<see cref="XmlConfigurationAttribute"/>的新实例
        /// </summary>
        /// <param name="owner">所属配置节点</param>
        /// <param name="name">属性名称</param>
        /// <param name="value">属性值</param>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-12-15 11:59    Created
        /// </history>
        public XmlConfigurationAttribute( XmlConfigurationNode owner, string name, string value )
        {
            //保存参数
            this.m_Owner = owner;
            this.m_Name = name;
            this.m_Value = value;
        }

        #endregion

        #region ---IConfigurationAttribute

        /// <summary>
        /// 获得当前配置属性所属的配置节点
        /// </summary>
        /// <value>当前配置属性所属的配置节点</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-11-13 11:37    Created
        /// </history>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-12-15 12:01    Created
        /// </history>
        public IConfigurationNode Node
        {
            get
            {
                return this.m_Owner;
            }
        }

        /// <summary>
        /// 获得当前配置属性的名称
        /// </summary>
        /// <value>当前配置属性的名称</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-11-13 11:38    Created
        /// </history>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-12-15 12:01    Created
        /// </history>
        public string Name
        {
            get
            {
                return this.m_Name;
            }
        }

        /// <summary>
        /// 获得或者设置当前属性的值
        /// </summary>
        /// <value>当前属性的值</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-11-13 11:39    Created
        /// </history>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]   2008-12-15 12:02    Created
        /// </history>
        public string Value
        {
            get
            {
                return this.m_Value;
            }
        }

        #endregion

        #region ---Field

        /// <summary>
        /// 所属配置节点
        /// </summary>
        private XmlConfigurationNode m_Owner;

        /// <summary>
        /// 属性名称
        /// </summary>
        private string m_Name;

        /// <summary>
        /// 属性值
        /// </summary>
        private string m_Value;

        #endregion
    }
}
